<template>
	<view class="content">
		<ul class="marginBottom20">
			<li>在css中使用颜色：$ct-primary (名字前拼接$ct)</li>
			<li>在js中使用颜色：this.$ct.color.primary</li>
		</ul>
		<ui-code :code="code"></ui-code>
		<view class="component">
			<template v-for="(item,index) in color">
				<view class="title">{{item.name}}</view>
				<view class="color">
					<template v-for="(citem,cindex) in item.list">
						<view class="color-item marginRight20" :style="{backgroundColor:citem[0],color:citem[2]?citem[2]:'#fff'}">
							{{citem[1]}}<br>{{citem[0]}}
						</view>
					</template>
				</view>
			</template>
		</view>
	</view>
</template>
<script>
	import code from './code.js';
	export default {
		data() {
			return {
				color: {},
				code:""
			}
		},
		created() {
			this.code = code;
			this.color = [{
					name: "主题色",
					list: [
						[this.$ct.color.primary, 'primary']
					]
				},
				{
					name: "错误/警告",
					list: [
						[this.$ct.color.error, 'error']
					]
				},
				{
					name: "辅助色",
					list: [[this.$ct.color.sub_a,"sub_a"], [this.$ct.color.sub_b,"sub_b"], [this.$ct.color.sub_c,"sub_c"]]
				},
				{
					name: "主要颜色",
					list: [[this.$ct.color.main_a,"main_a"], [this.$ct.color.main_b,"main_b"], [this.$ct.color.main_c,"main_c"], [this.$ct.color.main_d,"main_d"],
						[this.$ct.color.main_e,"main_e"], [this.$ct.color.main_f,"main_f","#999"]
					]
				},
			]
		},
		methods: {}
	}
</script>

<style lang="scss" scoped>
	.color {
		display: flex;
		flex-wrap: wrap;
	}
	
	.color-item {
		width: 20%;
		height: 150rpx;
		flex-shrink: 0;
		border-radius: 10rpx;
		font-size: 24rpx;
		text-align: center;
		padding-top: 40rpx;
		box-sizing: border-box;
		color: #fff;
		margin-top: 24rpx;
	}
</style>